package com.mxpio.erp.common.plan.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_PLAN_MPS_LINE_TEMP")
@Schema(description="主计划清单temp")
public class MpsLineTemp extends BaseEntity {

	private static final long serialVersionUID = 1L;
	
	@Id
	@Generator
	@Column(name = "ID_", length = 64)
	@Schema(description = "ID")
	private String id;

	@Column(name = "PID_", length = 64)
	@Schema(description = "PID")
	private String pid;

	@Column(name = "VERSION_CODE_", length = 64)
	@Schema(description = "版本号")//主计划版本关联外键
	private String versionCode;

	@Column(name = "DATA_TYPE_")
	@Schema(description = "需求类型(销售订单/组织需求/预留需求)")//
	private String dataType;

	@Column(name = "BIZ_CODE_", length = 64)
	@Schema(description = "业务单号")
	private String bizNo;
	
	@Column(name = "BIZ_LINE_NO_", length = 64)
	@Schema(description = "业务单行号")
	private String bizLineNo;
	
	@Column(name = "ITEM_CODE_", length = 64)
	@Schema(description = "物料代码")
	private String itemCode;
	
	@Column(name = "QUANTITY_")
	@Schema(description = "计划数量")
	private BigDecimal quantity;
	
	@Column(name = "DELIVERY_DATE_")
	@Schema(description = "计划交付日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date deliveryDate;

	@Column(name = "DEMAND_UNIT_", length = 64)
	@Schema(description = "需求单位")
	private String demandUnit;

	@Column(name = "MEMO_")
	@Schema(description = "备注")
	private String memo;
	//关联字段
	@Transient
	@Schema(description = "物料名称")
	private String itemName ;

	@Transient
	@Schema(description = "规格型号")
	private String itemSpec;

	@Transient
	@Schema(description = "单位编号")
	@Dict(dicCode="ERP_TECH_UNIT_CODE")
	private String unitCode;

	@Transient
	@Schema(description = "图号")
	private String drawingNo;

	@Transient
	@Schema(description = "需求数量")
	private BigDecimal needQuantity;

	@Transient
	@Schema(description = "需求日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date needDate;

}
